package com.myblog.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class SpringMvcConfigurationInitializer extends WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        //其中plate表示访问的前缀。"file:/opt/plate/"是文件真实的存储路径
        registry.addResourceHandler("/files/**").addResourceLocations("file:/D:/userr/myblog/files/");
        //file:/opt/plate/指向本地图片路径地址
        super.addResourceHandlers(registry);
    }
}
